package com.example.demo5datajpa.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.util.Date;

/**
 * 作用说明：
 *
 * @create 2017-08-28 23:39
 **/
@NoArgsConstructor
@AllArgsConstructor
@ToString
@Data
@Entity
@Table(name = "DEPT")
@NamedQuery(name = "Dept.queryByIsTop",query = "select d from Dept d where d.isTop=?1")
public class Dept{


    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    @Column(nullable = false)
    private String name;

    @Column(name = "order_no",nullable = false,length = 12)
    private Integer orderNo;

    @Column(name = "is_top")
    private Boolean isTop=false;
    //时间字段
    @Column(name = "create_time_stamp")
    //@Temporal(TemporalType.TIMESTAMP)
    private Date createTimeStamp;

    @Column(name = "create_date")
    //@Temporal(TemporalType.DATE)
    private  Date createDate;

    @Column(name = "create_time")
    //@Temporal(TemporalType.TIME)
    private Date createTime;


    public Dept(String name, Integer orderNo) {
        this.name = name;
        this.orderNo = orderNo;
    }

    public Dept(String name, Integer orderNo, Boolean isTop) {
        this.name = name;
        this.orderNo = orderNo;
        this.isTop = isTop;
    }
}
